/**
 * 
 */
package hihocoder;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 为了Hiho的荣耀 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int m = scanner.nextInt();
		scanner.nextLine();
		String A = scanner.nextLine();
		String B = scanner.nextLine();
		// 把B置反
		StringBuilder sBuilder = new StringBuilder(B.length());
		for (int i = 0; i < m; i++) {
			if (B.charAt(i) == '0') {
				sBuilder.append("1");
			} else {
				sBuilder.append("0");
			}
		}
		B = sBuilder.toString();

		int N = A.length();
		int start = 0;
		int end = 0;
		char curCh = A.charAt(0);
		double posi[] = new double[2];

		for (int i = 1; i < A.length(); i++) {
			if (curCh == A.charAt(i)) {
				end = i;
			} else {
				posi[curCh - '0'] += ((double) start / N * (end - start + 1) * (end - start + 1) / (N - i));
				start = i;
				end = i;
				curCh = A.charAt(i);
			}
		}
		double freqInB[] = new double[2];
		for (int i = 0; i < B.length(); i++) {
			if (B.charAt(i) == '0') {
				freqInB[0]++;
			}
		}
		freqInB[0] /= B.length();
		freqInB[1] = 1 - freqInB[0];
		double result = freqInB[0] * posi[0] + freqInB[1] * posi[1];
		System.out.println(result);
	}
}
